package org.example.kunkun_filter.dao;

import com.fasterxml.jackson.annotation.JsonProperty;

public class WechatLoginResponse {
    private String openid;
    private String sessionKey;
    private String unionid;
    private Integer errcode;
    private String errmsg;

    // getters and setters


    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public void setSessionKey(String sessionKey) {
        this.sessionKey = sessionKey;
    }

    public void setUnionid(String unionid) {
        this.unionid = unionid;
    }

    public void setErrcode(Integer errcode) {
        this.errcode = errcode;
    }

    public void setErrmsg(String errmsg) {
        this.errmsg = errmsg;
    }

    @JsonProperty("openid")
    public String getOpenid() {
        return openid;
    }

    @JsonProperty("session_key")
    public String getSessionKey() {
        return sessionKey;
    }

    @JsonProperty("unionid")
    public String getUnionid() {
        return unionid;
    }

    @JsonProperty("errcode")
    public Integer getErrcode() {
        return errcode;
    }

    @JsonProperty("errmsg")
    public String getErrmsg() {
        return errmsg;
    }

    public boolean isSuccess() {
        return errcode == null || errcode == 0;
    }
}